import numpy as np

# create a null vector of size 10
Z = np.zeros(10)
# the fifth value is 1
Z[4] = 1
# ranging from 10 to 50
T = np.arange(10,50)

# reverse a vector
T = T[::-1]

# create a martix with values from 0 to 8
Q = np.arange(9).reshape(3,3)

# find index of non-zero elements from vetor
nz = np.nonzero([1,2,0,0,3,00,4])
# create identity martix
W = np.eye(3)

# create a 3 3 3 arrary with random values
E = np.random.random((3,3,3))

# create a 10 10 arrary with random values and found the max, min value
R = np.random.random((10,10))
Rmax = R.max();Rmin=R.min()
# create a random vector of size 30 find the mean value
T = np.random.random(30)
Tmean = T.mean()
# 全１二维数组
Y = np.ones((10,10))

U = np.diag(1+np.arange(4),k=-1)
Z = np.zeros((8,8),dtype=int)
Z[1::2,::2] = 1
Z[::2,1::2] = 1

Z = np.ones((6,7,8))
Z[1,5,4] = 0

#print(np.unravel_index(100,(6,7,8)))
# Create a checkerboard 8x8 matrix using the tile function
Z = np.tile(np.array([[0,1],[1,0]]), (4,4))

Z = np.random.random((5,5))
Zmax = Z.max();Zmin=Z.min()
Z = (Z-Zmin)/(Zmax-Zmin)

#print(Z)

color = np.dtype([("r", np.ubyte, 1),
                  ("g", np.ubyte, 1),
                  ("b", np.ubyte, 2),
                  ("a", np.ubyte, 5)])
print(color)

